from celery import Celery
from ronglian_sms_sdk import SmsSDK
from h2004a_md import settings

app = Celery("taks", broker="redis://localhost/1")

# 定义 任务

# 发送短信任务
import time


@app.task()
def sendSMS(phone, code):
    # 初始化SDK开发工具包
    sdk = SmsSDK(settings.ACCOUNT_SID, settings.AUTH_TOKEN, settings.APP_ID)
    time.sleep(10)
    # 发送
    sdk.sendMessage(1, phone, (code, 2))
    print("======发送短信======")
